<?php

namespace app\api\model;

use think\Model;
use think\model\concern\SoftDelete;

class BossModel extends ApiModel
{

    use SoftDelete;


    // 表名
    protected $name = 'boss';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'create_time';
    protected $updateTime = 'update_time';
    protected $deleteTime = 'delete_time';

    // 追加属性
    protected $append = [

    ];


    public function getBossList()
    {

        $list = (new BossModel())
            ->where(['status' => 1])
            ->order('sort desc,id desc')
            ->field('id,name,image,phone,address,describe,latitude,longitude')
            ->paginate(10);
        foreach ($list as $key => &$value) {
            $value['image'] = config('app.image_url') . $value['image'];
        }

        return $this->api_success('获取成功', $list);
    }


}
